import type { GuessLikeList, PagesInfo } from '@/types/global'
import type { BannerItem, CategoryList, HotPanelList, GuessListItem } from '@/types/home'
import { http } from '@/utils/http'

/**
 * 首页-广告区域-小程序
 * @param distributionSite 广告区域展示位置（投放位置 投放位置，1为首页，2为分类商品页） 默认是1
 */
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite, // 默认值为 1
    },
  })
}
// 前台分类
export const getCategoryAPI = () => {
  return http<CategoryList[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}
// 热门推荐
export const getHotPanelAPI = () => {
  return http<HotPanelList[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}
// 猜你喜欢 GuessLikeList返回值类型 GuessListItem返回值数组类型
export const getGuessAPI = (params?: PagesInfo) => {
  return http<GuessLikeList<GuessListItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data: params,
  })
}
